<?php

defined('PHPFOX') or exit('NO DICE!');

class Event_Component_Block_AddPeople extends Phpfox_Component
{
    public function process()
    {
   
    	$mId = $this->request()->getInt('req2');
		
		if (!($aEvent = Phpfox::getService('event')->getEventById($mId)))
		{
			return;
		}
    
		$aListFriends = Phpfox::getService("event")->getCurrentInvitesUser($aEvent['event_id']);
		
		
		$sCond = 'friend.user_id='.Phpfox::getUserId().' and u.profile_page_id=0 ';
		if(trim($aListFriends)!="")
		{
			$sCond.= 'and friend.friend_user_id not in ('.$aListFriends.')';
		}
		
		list($iCnt,$aFriends) = Phpfox::getService("friend")->get($sCond,null,1,8);
		
        $this->template()->assign(array(
            'sHeader' => 'Add people to group',
            'aFriends' => $aFriends,
            'event_id' => $aEvent['event_id'],
            'iCnt' => $iCnt,	
            'core_path' => Phpfox::getParam("core.path"),	
        ));
        return 'block';
    }
}

?>